<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<link href="../../../jquery/bootstrap_3.3.0/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
<link href="../../../jquery/bootstrap-datetimepicker-master/css/bootstrap-datetimepicker.min.css" type="text/css" rel="stylesheet" />

<script type="text/javascript" src="../../../jquery/jquery-1.11.1-min.js"></script>
<script type="text/javascript" src="../../../jquery/bootstrap_3.3.0/js/bootstrap.min.js"></script>
</head>
<body>

	<div style="position:  relative; left: 30px;">
		<h3>新增字典类型</h3>
	  	<div style="position: relative; top: -40px; left: 70%;">
			<button id="btnAdd" type="button" class="btn btn-primary">保存</button>
			<button type="button" class="btn btn-default" onclick="window.history.back();">取消</button>
		</div>
		<hr style="position: relative; top: -40px;">
	</div>
	<form class="form-horizontal" role="form">
					
<!--		<div class="form-group">-->
<!--			<label for="create-code" class="col-sm-2 control-label">编码<span style="font-size: 15px; color: red;">*</span></label>-->
<!--			<div class="col-sm-10" style="width: 300px;">-->
<!--				<input type="hidden"    class="form-control" id="code" style="width: 200%;" placeholder="编码作为主键，不能是中文">-->
<!--			</div>-->
<!--		</div>-->
		
		<div class="form-group">
			<label for="create-name" class="col-sm-2 control-label">名称</label>
			<div class="col-sm-10" style="width: 300px;">
				<input type="text" class="form-control" id="name" style="width: 200%;">
			</div>
		</div>
		
		<div class="form-group">
			<label for="create-describe" class="col-sm-2 control-label">描述</label>
			<div class="col-sm-10" style="width: 300px;">
				<textarea class="form-control" rows="3" id="describe" style="width: 200%;"></textarea>
			</div>
		</div>
	</form>
	
	<div style="height: 200px;"></div>
</body>
</html>

<script>

	$(function (){

		$("#btnAdd").click(function (){
				$.ajax({
						url:"/DictionaryType/add.action",
					    type:"post",
						dataType:"json",
						data:{
							name:$("#name").val(),
							description:$("#describe").val()
						},
						beforeSend:function (XMLHttpRequest) {

						},
						error:function (XMLHttpRequest,textStatus, errorThrown) {
						},
						success:function (data, textStatus, jqXHR) {

							if(data['result']=="success"){
								window.location.href='index.html';
							}
							else{
								window.alert(data['mess']);
							}
						},
						complete:function (XMLHttpRequest, textStatus) {
						}
					});
		});


	});
</script>